using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ManagementClinic.Data.Models.Mapping
{
    public class THUOC_TON_KHOMap : EntityTypeConfiguration<THUOC_TON_KHO>
    {
        public THUOC_TON_KHOMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.MODIFY_USER)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("THUOC_TON_KHO");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.ID_THUOC).HasColumnName("ID_THUOC");
            this.Property(t => t.DON_GIA_NHAP).HasColumnName("DON_GIA_NHAP");
            this.Property(t => t.DON_GIA_THANH_TOAN).HasColumnName("DON_GIA_THANH_TOAN");
            this.Property(t => t.SO_LUONG).HasColumnName("SO_LUONG");
            this.Property(t => t.MODIFY_USER).HasColumnName("MODIFY_USER");
            this.Property(t => t.MODIFY_DATE).HasColumnName("MODIFY_DATE");

            // Relationships
            this.HasRequired(t => t.THUOC)
                .WithMany(t => t.THUOC_TON_KHO)
                .HasForeignKey(d => d.ID_THUOC);

        }
    }
}
